//
//  SEGCommonDoorManager.m
//  Commom
//
//  Created by Clavis on 2019/4/11.
//  Copyright © 2019 山刘. All rights reserved.
//

#import "SEGCommonDoorManager.h"

#if __has_include(<Commom/SEGProfileManager.h>)
#import <Commom/SEGProfileManager.h>
#else
#import "SEGProfileManager.h"
#endif

static id _commonDoorManager;
static dispatch_once_t onceToken;

//门禁列表接口
#define kMyDoorList [SEGServerManager serverUrlJoint:kClientRootURL,@"/door-restapi/v1/userapp/doorList",nil]

@implementation SEGCommonDoorManager

+(instancetype)sharedManager{
    dispatch_once(&onceToken, ^{
        _commonDoorManager = [[self alloc] init];
    });
    return _commonDoorManager;
}

+(void)destroyResource{
    onceToken = 0;
    _commonDoorManager = nil;
}

/**
 拉取所有门列表

 @param finished 回调
 */
-(void)requestmyDoorListFinished:(SEGNetworkReponse)finished {
    
    NSDictionary *params = @{@"custId":[SEGProfileManager sharedManager].profile.custId ?: @"",
                             @"communityId": kAccountCommunityID ?: @""};
    
    [SEGHTTPBusinessManager seg_requestWithMethod:GET URLString:kMyDoorList parameters:params finished:^(BOOL isSuccessed, id result, NSString *codeType, NSString *errorMessage) {
        
        finished(isSuccessed, result, codeType, errorMessage);
    }];
}

@end
